TedKeyboardObserver

Additional

Language
Kotlin
Version
N/A
Created
Feb 26, 2019
Updated
Jul 25, 2021 (Retired)
Owner
Ted Park (ParkSangGwon)
Contributors
Ted Park (ParkSangGwon)
ted-prnd
dino (sjjeong)
3
Activity
Badge
Generate
Download
Source code

Advertisement

What is TedKeyboardObserver?

  • Sometime we want to know keyboard's visibility. (When keyboard shown, change some layout or do something. etc..)
  • But Android SDK doesn't have any observer.
  • TedKeyboardObserver provide keyboard visibility



Demo

  • You can observe keyboard status like this





    - Keyboard show / hide

Setup

Gradle

dependencies {
    implementation 'io.github.ParkSangGwon:tedkeyboardobserver:x.y.z'
    //implementation 'io.github.ParkSangGwon:tedkeyboardobserver:1.0.1'
}

If you think this library is useful, please press star button at upside.


How to use

TedKeyboardObserver support Listener and RxJava style

RxJava

  • You don't need dispose this observable. When activity destroy, TedRxKeyboardObserver will call onComplete()

Java

       new TedRxKeyboardObserver(this)
                .listen()
                .subscribe(isShow -> {
                            // do something
                        }, Throwable::printStackTrace);

Kotlin

       
        TedRxKeyboardObserver(this)
            .listen()
            .subscribe({ isShow -> // do something }
                , { throwable -> throwable.printStackTrace() })



Listener

Java

      new TedKeyboardObserver(this)
                .listen(isShow -> {
                    // do something
                });

Kotlin

      TedKeyboardObserver(this)
               .listen { isShow ->
                    // do something
               }



License

Copyright 2019 Ted Park

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.```